package com.example.sb.pojo;

import javax.persistence.AttributeConverter;

/**
 * @author kedong.lin
 */
public class SexConverter implements AttributeConverter<SexEnum,Integer> {
    @Override
    public Integer convertToDatabaseColumn(SexEnum sexEnum) {

        return sexEnum.getCode();
    }

    @Override
    public SexEnum convertToEntityAttribute(Integer code) {
        return SexEnum.getEnumById(code);
    }
}
